package com.test.designmode.strategy;

public class Context {
    private Strategy strategy;

    public Context(Strategy strategy){
        System.out.println("用构造器初始化策略");
        this.strategy = strategy;
    }

    public int executeStrategy(int num1, int num2){
        System.out.println("执行策略的业务方法");
        return strategy.doOperation(num1, num2);
    }
}
